home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / bro / IntroBro1.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  3.1 KB  |  137 lines

  1. class classes.bro.IntroBro1
  2. {
  3.    var x;
  4.    var y;
  5.    var clip;
  6.    var dir;
  7.    var oldDir;
  8.    var c = 0;
  9.    var xMov = 0;
  10.    var yMov = 0;
  11.    var xA = 0;
  12.    var yA = 0;
  13.    var state = "walk";
  14.    var f2 = "working";
  15.    function IntroBro1(px, py)
  16.    {
  17.       this.x = px;
  18.       this.y = py;
  19.       this.clip = _root.attachMovie("introBro1","introBro1Clip",90500);
  20.       this.clip._x = this.x;
  21.       this.clip._y = this.y;
  22.       this.clip.gotoAndStop("work");
  23.       this.dir = "work";
  24.    }
  25.    function working()
  26.    {
  27.       if(random(1000) > 998)
  28.       {
  29.          if(!_root.bro2Cooler)
  30.          {
  31.             _root.bro1Cooler = true;
  32.             this.x = 762 + this.clip.work.xTracker._x;
  33.             _root.introScreen.bro1._visible = true;
  34.             _root.introScreen.bro1.gotoAndStop("noBro");
  35.             this.dir = "L";
  36.             this.xMov = -3;
  37.             this.f2 = "goingToCooler";
  38.          }
  39.       }
  40.    }
  41.    function startGame()
  42.    {
  43.       if(this.dir == "work")
  44.       {
  45.          this.x = 762 + this.clip.work.xTracker._x;
  46.       }
  47.       else if(this.dir == "cooler")
  48.       {
  49.          this.x = 690 + this.clip.cooler.xTracker._x;
  50.       }
  51.       this.f2 = "";
  52.       _root.introScreen.bro1._visible = true;
  53.       _root.introScreen.bro1.gotoAndPlay("noBro");
  54.       this.dir = "L";
  55.       this.xMov = -5;
  56.    }
  57.    function goingToCooler()
  58.    {
  59.       if(this.x <= 690)
  60.       {
  61.          this.x = 690;
  62.          this.xMov = 0;
  63.          this.dir = "cooler";
  64.          this.f2 = "cooler";
  65.       }
  66.    }
  67.    function cooler()
  68.    {
  69.       if(this.clip.cooler.end)
  70.       {
  71.          this.x = 639;
  72.          this.dir = "R";
  73.          this.xMov = 3;
  74.          this.f2 = "gotoWork";
  75.       }
  76.    }
  77.    function gotoWork()
  78.    {
  79.       if(this.x >= 759)
  80.       {
  81.          _root.bro1Cooler = false;
  82.          this.x = 735;
  83.          this.dir = "work";
  84.          this.xMov = 0;
  85.          this.f2 = "working";
  86.          _root.introScreen.bro1._visible = false;
  87.       }
  88.    }
  89.    function wait()
  90.    {
  91.       this.state = "wait";
  92.       this.dir = "";
  93.       this.xMov = 0;
  94.    }
  95.    function gotoPunchOut()
  96.    {
  97.       this.clip.body.gotoAndPlay("walk");
  98.       this.xMov = -4;
  99.    }
  100.    function punchOut()
  101.    {
  102.       this.xMov = 0;
  103.       this.clip._x = 264;
  104.       this.clip.body.gotoAndPlay("punchOut");
  105.       _root.coins.addTo(7);
  106.       _root.audio.playLevel3("coin5",_root.randRange(21,24));
  107.    }
  108.    function exit()
  109.    {
  110.       this.clip.body.gotoAndPlay("walk");
  111.       this.x = 261;
  112.       this.xMov = -5;
  113.       this.f2 = "exiting";
  114.       _root.introBro2Clip._alpha = 0;
  115.       this.clip.setMask(_root.introBroMaskClip);
  116.       this.clip._alpha = 150;
  117.    }
  118.    function exiting()
  119.    {
  120.       this.clip._alpha -= 3;
  121.    }
  122.    function main()
  123.    {
  124.       this[this.f2]();
  125.       if(this.oldDir != this.dir)
  126.       {
  127.          this.clip.gotoAndStop(this.dir);
  128.          this.clip.body.gotoAndPlay(this.state);
  129.       }
  130.       this.oldDir = this.dir;
  131.       this.x += this.xMov + this.xA;
  132.       this.y += this.yMov + this.yA;
  133.       this.clip._x = this.x;
  134.       this.clip._y = this.y;
  135.    }
  136. }
  137.